import 'package:equatable/equatable.dart';
import 'package:backend.purchases/domain/entities/yookassa_api/payments/yookassa_api_pending_payment.dart';

const kYookassaApiPendingPaymentPaymentMethodIdKey = 'id';
const kYookassaApiPendingPaymentPaymentMethodSavedKey = 'saved';

class YookassaApiPendingPaymentMethodDto extends Equatable {
  const YookassaApiPendingPaymentMethodDto._internal({
    required this.id,
    required this.saved,
  });

  final String id;
  final bool saved;

  @override
  List<Object?> get props {
    return [
      id,
      saved,
    ];
  }

  factory YookassaApiPendingPaymentMethodDto.fromJson(Map<String, dynamic> json) {
    return YookassaApiPendingPaymentMethodDto._internal(
      id: json[kYookassaApiPendingPaymentPaymentMethodIdKey],
      saved: json[kYookassaApiPendingPaymentPaymentMethodSavedKey],
    );
  }

  YookassaApiPendingPaymentMethod toEntity() {
    return YookassaApiPendingPaymentMethod(
      id: id,
      saved: saved,
    );
  }
}
